<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>作业7 | Hugo Theme Dream</title>

    



<meta name="author" content="Lindixuan" />
<meta name="description" content="" />



<meta name="generator" content="Hugo 0.63.2" />

<link rel="canonical" href="https://lindixuan.gitee.io/post/%E4%BD%9C%E4%B8%9A7/" />


<meta property="og:title" content="作业7" />
<meta property="og:description" content="" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://lindixuan.gitee.io/post/%E4%BD%9C%E4%B8%9A7/" />
<meta property="article:published_time" content="2020-10-13T12:47:35+08:00" />
<meta property="article:modified_time" content="2020-10-13T12:47:35+08:00" />



<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="作业7"/>
<meta name="twitter:description" content=""/>


<link rel="stylesheet" href="/css/semantic.min.css" />
<link rel="stylesheet" href="/css/OverlayScrollbars.min.css" />
<link rel="stylesheet" href="/css/github-markdown.css" />
<link rel="stylesheet" href="/css/site.css" />


<style>
  a {
    color: seagreen !important;
  }
</style>



<style>
  .inverted a {
     color: darkseagreen !important;
  }
</style>


    


  
    <link rel="stylesheet" data-highlight href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/gruvbox-light.min.css" />
  



  </head>

  
  <body style="background: white;">
  
    
<nav class="ui secondary inverted menu dream-menu">

  <div class="item">
    <i class="large link bullseye icon dream-flip-toggle" title="Flip it!"></i>
  </div>
  <div class="item">
    <i class="large link home icon" title="Home" onclick="window.location.href = 'https:\/\/lindixuan.gitee.io'"></i>
  </div>
  <div class="item">
    <i class="large link icon theme-switch" onclick="themeSwitch()"></i>
  </div>
  
  <div class="item">
    <i class="large link search icon" onclick="toggleSearch()"></i>
  </div>
  
</nav>

    <div class="flip-container">
      <div class="flipper">
        <section class="front">
          <div class="dream-max-width">
            
<div class="ui centered relaxed grid dream-grid">
  <div class="sixteen wide mobile sixteen wide tablet twelve wide computer column markdown-body dream-single">

    <section class="ui top attached segment" id="dream-save-post-as-img">
      <header style="margin-top: 0 !important;">
        <h1 class="ui large header">
          作业7
          <div class="sub header">
            @
            
              Lindixuan
            
            · Tuesday, Oct 13, 2020
            · 2 minute read
            · Update at Oct 13, 2020
          </div>
        </h1>
      </header>

      
        <img class="ui image" style="margin-top: 2rem;" src="" />
      

      <article style="margin-top: 2rem;"><h1 id="1program-with-machine-language-according-to-the-following-c">1、Program with machine language according to the following c.</h1>
<h1 id="int_8-a--1--int_8-c--a--3">int_8 a = 1;  int_8 c = a + 3;</h1>
<h2 id="1write-your-assembly-code--machine-code">1）Write your assembly code &amp; machine code</h2>
<blockquote>
<p><strong>assembly code</strong><br>
a db 0<br>
c db 0<br>
mov al, 1<br>
mov a, al
add al, 3<br>
mov c, al</p>
</blockquote>
<blockquote>
<p><strong>machine code</strong><br>
00010100 00000001<br>
00000101 10000001<br>
00010100 10000001<br>
00010000 00000011<br>
00000100 10000002<br>
00001111 00000000</p>
</blockquote>
<h2 id="2explain-machine-code-execution-with-the-fetch-decode-execute-cycle">2）Explain machine code execution with the fetch-decode-execute cycle</h2>
<blockquote>
<p>Main memory–&gt;fetch instruction–&gt;Decode instruction–&gt;Registers –&gt;Get data–&gt;Execute the instruction–&gt; Main memory</p>
</blockquote>
<h2 id="3explain-functions-about-ir-pc-acc-registers-in-a-cpu">3）Explain functions about IR, PC, ACC registers in a CPU</h2>
<blockquote>
<p>指令寄存器（IR，Instruction Register），用于暂存当前正在执行的指令。指令寄存器的时钟信号是clk，在clk的上升沿触发。指令寄存器将数据总线送来的指令存入16位的寄存器中，但并不是每次数据总线上的数据都需要寄存，因为数据总线上有时传输指令，有时传输数据。由CPU状态控制器的 Ir_ena信号控制数据是否需要寄存。复位时，指令寄存器被清零</p>
</blockquote>
<blockquote>
<p>PC,程序计数器。当执行一条指令时，首先需要根据PC中存放的指令地址，将指令由内存取到指令寄存器中，此过程称为“取指令”。与此同时，PC中的地址或自动加1或由转移指针给出下一条指令的地址。</p>
</blockquote>
<blockquote>
<p>ACC（Accumulator）是累加器A缩写。累加器A是一个具有特殊用途的二进制8位寄存器，专门用来存放操作数或运算结果。在CPU执行某种运算前，两个操作数中的一个通常应放在累加器A中，运算完成后累加器A中便可得到运算结果。</p>
</blockquote>
<h2 id="4explain-physical-meaning-about-vars-a--c-in-a-machine">4）Explain physical meaning about vars a &amp; c in a machine</h2>
<blockquote>
<p>在内存中申请一块内存作为a和c的空间</p>
</blockquote>
<h1 id="2简答题">2、简答题</h1>
<h2 id="1what-are-stored-in-memory">1）What are stored in memory?</h2>
<blockquote>
<p>数据信息、操作系统、应用软件</p>
</blockquote>
<h2 id="2can-a-data-or-a-instruction-stored-in-the-same-place">2）Can a data or a instruction stored in the same place?</h2>
<blockquote>
<p>数据和指令可以放在一个位置</p>
</blockquote>
<h2 id="3-explain-instruction-format-with-example-instructions">3） Explain Instruction Format with example instructions.</h2>
<blockquote>
<p>计算机的指令格式与计算机的字长、存储器容量以及指令功能密切相关。一条指令必须包括操作码和地址码。<br>
比如MIPS中的指令有R型指令和I型指令。<br>
R型指令中的字段命名：<br>
op：指令的基本操作，成为操作码<br>
rs：第一源操作数寄存器<br>
rt：第二源操作数寄存器<br>
rd：存放操作结果的目的寄存器<br>
shamt：位移量<br>
funct：功能码<br>
<img src="https://lindixuan.gitee.io/post/assets/%E4%BD%9C%E4%B8%9A7/r%E6%8C%87%E4%BB%A4.png" alt="pic"><br>
I型指令中的字段命名：<br>
op：指令的基本操作，成为操作码<br>
rs：第一源操作数寄存器<br>
rt：第二源操作数寄存器<br>
immediate：立即数<br>
<img src="https://lindixuan.gitee.io/post/assets/%E4%BD%9C%E4%B8%9A7/i%E6%8C%87%E4%BB%A4.png" alt="pic"></p>
</blockquote>
<h1 id="3解释以下词汇">3、解释以下词汇</h1>
<h2 id="1汇编语言assembly-language">1）汇编语言（Assembly Language）</h2>
<blockquote>
<p>汇编语言是任何一种用于电子计算机、微处理器、微控制器，或其他可编程器件的低级语言。在不同的设备中，汇编语言对应着不同的机器语言指令集。一种汇编语言专用于某种计算机系统结构，而不像许多高级语言，可以在不同系统平台之间移植。</p>
</blockquote>
<blockquote>
<p>In computer programming, assembly language (or assembler language), often abbreviated asm, is any low-level programming language in which there is a very strong correspondence between the instructions in the language and the architecture&rsquo;s machine code instructions. Because assembly depends on the machine code instructions, every assembly language is designed for exactly one specific computer architecture.</p>
</blockquote>
<h2 id="2编译compiler">2）编译（Compiler）</h2>
<blockquote>
<p>编译器（compiler）是一种计算机程序，它会将某种编程语言写成的源代码（原始语言）转换成另一种编程语言（目标语言）。</p>
</blockquote>
<blockquote>
<p>In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language).</p>
</blockquote>
<h2 id="3命令式语言imperative-programming">3）命令式语言（Imperative programming）</h2>
<blockquote>
<p>指令式编程（英语：Imperative programming）；是一种描述电脑所需作出的行为的编程典范。几乎所有电脑的硬件工作都是指令式的；几乎所有电脑的硬件都是设计来运行机器代码，使用指令式的风格来写的。较高端的指令式编程语言使用变量和更复杂的语句，但仍依从相同的典范。菜谱和行动清单，虽非计算机程序，但与指令式编程有相似的风格：每步都是指令，有形的世界控制情况。因为指令式编程的基础观念，不但概念上比较熟悉，而且较容易具体表现于硬件，所以大部分的编程语言都是指令式的。</p>
</blockquote>
<blockquote>
<p>In computer science, imperative programming is a programming paradigm that uses statements that change a program&rsquo;s state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates.</p>
</blockquote>
<h2 id="4函数编程语言functional-programming">4）函数编程语言（Functional programming）</h2>
<blockquote>
<p>函数式编程（英语：functional programming）或称函数程序设计、泛函编程，是一种编程范式，它将电脑运算视为函数运算，并且避免使用程序状态以及易变对象。其中，λ演算（lambda calculus）为该语言最重要的基础。而且，λ演算的函数可以接受函数当作输入（引数）和输出（传出值）。</p>
</blockquote>
<blockquote>
<p>In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that each return a value, rather than a sequence of imperative statements which change the state of the program.</p>
</blockquote>
<h2 id="5过程式编程procedural-programming">5）过程式编程（Procedural programming）</h2>
<blockquote>
<p>过程式程序设计（英语：Procedural programming），又称过程式编程、过程化编程，一种编程典范，有时会被视为是指令式编程的同义语。派生自结构化编程（Structured programming），主要采取程序调用（procedure call）或函数调用（function call）的方式来进行流程控制。流程则由包涵一系列运算步骤的过程（Procedures），例程（routines），子程序（subroutines）, 方法（methods），或函数（functions）来控制。</p>
</blockquote>
<blockquote>
<p>Procedural programming is a programming paradigm, derived from structured programming,[citation needed] based on the concept of the procedure call. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program&rsquo;s execution, including by other procedures or itself.</p>
</blockquote></article>
    </section>

    <footer class="ui attached segment dream-tags">
      
          <a class="ui label">No Tags</a>
      
      <div
        class="ui label"
        style="float: right; cursor: pointer;"
        onclick="savePostAsImg()">
        <i class="save icon"></i>Save as image
      </div>
    </footer>

    

    
    
    

  </div>
  <div class="sixteen wide mobile sixteen wide tablet four wide computer column">
    <article class="dream-header">
  <section class="ui top attached center aligned segment">
    <div class="ui small circular image">
      
        <img src="/img/sleep.jpg">
      
    </div>

    
    <h1 class="ui medium header">Lindixuan&#39;s blog<div class="sub header" style="margin-top: 0.5rem;">好耶！</div>
    </h1>
    

    <div class="ui horizontal list">
      
      <a class="item" href="/tags">
        <i class="tags icon" title="All Tags"></i>
      </a>
      <a class="item" href="/categories">
        <i class="th list icon" title="All Categories"></i>
      </a>
    </div>
  </section>

  

  

  <section class="ui attached segment header-socials">
    <nav class="ui secondary menu dream-menu dream-socials">
  
  
    <div class="item">
      <a href="mailto:1228210482@qq.com">
        <i class=" mail icon" title="Email"></i>
      </a>
    </div>
  

  

  

  

  

  

  

  
</nav>

  </section>

  <section class="ui bottom attached center aligned segment">
    
      <p>© 2020 - 2021 Hugo Theme Dream</p>
    

    <p>Powered by <a href="https://gohugo.io/" target="_blank">Hugo</a> with theme <a href="https://github.com/g1eny0ung/hugo-theme-dream" target="_blank">Dream</a>.</p>

    
  </section>
</article>

  </div>
</div>

          </div>
        </section>
        <section class="back">
          <div class="dream-max-width">
            <div class="ui centered relaxed grid dream-grid dream-back">
  
  
  

  <section class="sixteen wide mobile eight wide tablet four wide computer column dream-column">
    <article>
      <div class="ui top attached segment">
        <h3 class="ui header">Social Links</h3>
      </div>
      <div class="ui bottom attached segment">
        <nav class="ui secondary menu dream-menu dream-socials">
  
  
    <div class="item">
      <a href="mailto:1228210482@qq.com">
        <i class="large mail icon" title="Email"></i>
      </a>
    </div>
  

  

  

  

  

  

  

  
</nav>

      </div>
    </article>
  </section>

  <section class="sixteen wide mobile eight wide tablet four wide computer column dream-column">
    
  </section>

  
    
  
</div>

          </div>
        </section>
      </div>
    </div>

    <script>
  window.darkNav =  true 
</script>
<script src="/js/jquery.min.js"></script>
<script src="/js/semantic.min.js"></script>
<script src="/js/jquery.overlayScrollbars.min.js"></script>
<script src="/js/header.js"></script>
<script src="/js/main.js"></script>
<script src="/js/theme.js"></script>

    
<script src="/js/html2canvas.min.js"></script>
<script src="/js/post.js"></script>


  <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js"></script>

  
    
      <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/languages/ocaml.min.js"></script>
     
  

  <script>
  hljs.initHighlightingOnLoad()
  setHighlightTheme()

  function setHighlightTheme() {
    var isDark = localStore.getItem('hugo-theme-dream-is-dark')
    var lightTheme = "gruvbox-light"
    var darkTheme = "gruvbox-dark"
    var theme = isDark ? darkTheme : lightTheme

    $('link[data-highlight]').attr('href', 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/' + theme + '.min.css')
    $('pre').css('background', isDark ? '#333' : '')
  }
</script>





    
      <div class="ui inverted segment" id="dream-search">
  <div class="ui search">
    <div class="ui transparent input">
      <input class="prompt" type="text" placeholder="Search" />
    </div>
    <div class="results"></div>
  </div>
</div>
<script>
  $(document).ready(function () {
    $.getJSON('https:\/\/lindixuan.gitee.io/index.json', function (data) {
      $('.ui.search').search({
        source: data,
        searchFields: ['title'],
        showNoResults: true,
      })
    })
  })
</script>
<script src="/js/search.js"></script>

    

    
  </body>
</html>
